QuickSetting = class()

function QuickSetting:init()
    
    self.showing = false
    self.yp = HEIGHT
    
    self.ok = STButton(WIDTH/2,100,LP.ok,"Project:BB","Project:B")
    self.ok.width = 300
    self.ok.height = 60
    self.ok.color = color(255, 255, 255, 255)
    self.ok.pressedColor = color(136, 135, 135, 255)
    self.ok.clicked = function()
        tween(0.5,self,{yp = WIDTH},tween.easing.cubicOut,function() self.showing = false
            saveSetting()
        end)
    end
    
    self.buttons = {}
    local k = STSwitch(WIDTH * 0.3 + 40,HEIGHT * 0.8,250,70, LP.settings.ShowDebug,"Project:BB",SettingList.ShowDebug)
    k.changed = function(t)
        SettingList.ShowDebug = t
    end
    table.insert(self.buttons,k)
    
    j = STSwitch(WIDTH * 0.7 - 40,HEIGHT * 0.8,250,70, LP.settings.ShowDebugCollision,"Project:BB",SettingList.ShowDebugCollision)
    j.changed = function(t)
        SettingList.ShowDebugCollision = t
    end
    table.insert(self.buttons,j)
    w = STSwitch(WIDTH * 0.3 + 40,HEIGHT * 0.7,250,70,LP.settings.ShowTouchPos,"Project:BB",SettingList.ShowTouchPos)
    
    w.changed = function(t)
        SettingList.ShowTouchPos = t
    end
    table.insert(self.buttons,w)
    
end
function QuickSetting:show()
    
    self.showing = true
    self.yp = HEIGHT
    tween(0.5,self,{yp = 0},tween.easing.cubicOut)
    
end

function QuickSetting:draw()
    pushMatrix()
    pushStyle()
    textMode(CENTER)
    translate(0,self.yp)
    noStroke()
    rectMode(CENTER)
    fill(255, 255, 255, 255)
    rect(WIDTH/2,HEIGHT/2,600,700)
    fontSize(40)
    fill(0, 0, 0, 255)
    
    text(LP.qset,WIDTH/2,HEIGHT-70)
    self.ok:draw()
    fontSize(30)
    fill(0, 0, 0, 255)
    
    for k,v in pairs(self.buttons) do
        v:draw()
    end
    popStyle()
    popMatrix()
end

function QuickSetting:touched(touch)
    self.ok:touched(touch)
    for k,v in pairs(self.buttons) do
        v:touched(touch)
    end
end
